package org.yunai.swjg.server.module.inventory.item.template;

import org.jumpmind.symmetric.csv.CsvReader;
import org.yunai.yfserver.util.CsvUtil;

import java.io.IOException;

/**
 * 装备道具模版
 * User: yunai
 * Date: 13-4-7
 * Time: 下午9:53
 */
public class EquipmentItemTemplate extends ItemTemplate {
    /**
     * 力量
     */
    private Integer strength;
    /**
     * 敏捷
     */
    private Integer dexterity;
    /**
     * 智力
     */
    private Integer intelligence;
    /**
     * 攻击
     */
    private Integer attack;
    /**
     * 防御
     */
    private Integer defense;
    /**
     * 暴击率，未转化为百分比
     */
    private Double crit;
    /**
     * 闪避属性，未转化为百分比
     */
    private Double dodge;
    /**
     * 命中属性，未转化为百分比
     */
    private Double hit;
    /**
     * 攻速属性，未转化为百分比
     */
    private Double attackSpeed;
    /**
     * HP
     */
    private Integer hp;
    /**
     * 回血属性
     */
    private Double hpRegeneration;
    /**
     * MP
     */
    private Integer mp;
    /**
     * 回蓝属性
     */
    private Double mpRegeneration;

    public Integer getStrength() {
        return strength;
    }

    public Integer getDexterity() {
        return dexterity;
    }

    public Integer getIntelligence() {
        return intelligence;
    }

    public Integer getAttack() {
        return attack;
    }

    public Integer getDefense() {
        return defense;
    }

    public Double getCrit() {
        return crit;
    }

    public Double getDodge() {
        return dodge;
    }

    public Double getHit() {
        return hit;
    }

    public Double getAttackSpeed() {
        return attackSpeed;
    }

    public Integer getHp() {
        return hp;
    }

    public Double getHpRegeneration() {
        return hpRegeneration;
    }

    public Integer getMp() {
        return mp;
    }

    public Double getMpRegeneration() {
        return mpRegeneration;
    }

    // ==================== 非set/get方法 ====================
    public static void genEquipmentItemTemplate(CsvReader reader, ItemTemplate template) throws IOException {
        EquipmentItemTemplate equipmentItemTemplate = (EquipmentItemTemplate) template;
        equipmentItemTemplate.strength = CsvUtil.getInt(reader, "strength", 0);
        equipmentItemTemplate.dexterity = CsvUtil.getInt(reader, "dexterity", 0);
        equipmentItemTemplate.intelligence = CsvUtil.getInt(reader, "intelligence", 0);
        equipmentItemTemplate.attack = CsvUtil.getInt(reader, "attack", 0);
        equipmentItemTemplate.defense = CsvUtil.getInt(reader, "defense", 0);
        equipmentItemTemplate.crit = CsvUtil.getDouble(reader, "crit", 0D);
        equipmentItemTemplate.dodge = CsvUtil.getDouble(reader, "defense", 0D);
        equipmentItemTemplate.hit = CsvUtil.getDouble(reader, "hit", 0D);
        equipmentItemTemplate.attackSpeed = CsvUtil.getDouble(reader, "attackSpeed", 0D);
        equipmentItemTemplate.hp = CsvUtil.getInt(reader, "hp", 0);
        equipmentItemTemplate.hpRegeneration = CsvUtil.getDouble(reader, "hpRegeneration", 0D);
        equipmentItemTemplate.mp = CsvUtil.getInt(reader, "mp", 0);
        equipmentItemTemplate.mpRegeneration = CsvUtil.getDouble(reader, "mpRegeneration", 0D);
    }
}
